package com.martin.dms.web.services;

import java.util.List;

import com.martin.dms.web.beans.ItemBean;
import com.martin.dms.web.beans.SupplierBean;
import com.martin.dms.web.beans.SupplierManagementBean;

/**
 * Service used to control the Supplier web flow.
 * 
 * @author mtsvetkov
 */
public interface SupplierFlowService {

    /**
     * Searches for suppliers using the search criteria from <code>SupplierManagementBean</code>.
     * 
     * @param supplierManagementBean - contains the search criteria.
     * @param searchForSuppliers - if false an empty list is returned.
     * @return a list with the found suppliers or an empty list if <code>searchForSuppliers</code>
     *         is false.
     */
    public List<SupplierBean> searchSuppliers(SupplierManagementBean supplierManagementBean, boolean searchForSuppliers);

    /**
     * Searches for suppliers using the search criteria from <code>SupplierBean</code>.
     * 
     * @param supplierBean - contains the search criteria.
     * @param searchForItems - if false an empty list is returned.
     * @return a list with the found items without the ones who are already in the
     *         <code>supplierBean</code> or an empty list if <code>searchForItems</code> is false.
     */
    public List<ItemBean> searchForItems(SupplierBean supplierBean, boolean searchForItems);

    /**
     * Retrieves a supplier.
     * 
     * @param id - the id of the supplier.
     * @param copyAllData - if true all the data from the supplier will be filled in the
     *            <code>SupplierBean</code>. If false only the id and the name of the supplier will
     *            be filled.
     * @return a <code>SupplierBean</code>.
     */
    public SupplierBean getSupplier(long id, boolean copyAllData);

    /**
     * Deletes the supplier that the <code>SupplierBean</code> represents.
     * 
     * @param supplier - contains the id of the supplier that should be deleted.
     */
    public void deleteSupplier(SupplierBean supplier);

    /**
     * Saves the supplier represented by <code>supplierBean</code>.
     * 
     * @param supplierBean - contains the needed data to save the supplier.
     */
    public void saveSupplier(SupplierBean supplierBean);

    /**
     * Delivers items.
     * 
     * @param supplierBean - contains the information about which supplier will be used for the
     *            delivery, the type of items that will be delivered and their amount.
     * @return true if the delivery is successful, false otherwise.
     */
    public Boolean makeDelivery(SupplierBean supplierBean);
}
